<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>12进制的时钟特效</title>
		<style type="text/css">
		</style>
	</head>
	<body>
		<div id="time"></div>
		<p>
		<input type="button" value="停止" onclick="close_clock()" />&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" value="继续" onclick="goon()" />
		</p>
		<script>
			var flag=setInterval("clock_12h()",1000);
			function clock_12h(){
				var today=new Date();
				var year=today.getFullYear();
				var month=today.getMonth()+1;
				var day_of_Month=today.getDate();
				var hour=today.getHours();
				var minute=today.getMinutes();
				var second=today.getSeconds();
				var day_of_Week=today.getDay();
				var data;
				if(hour>12){
					data="PM";
					hour-=12;
				}else{
					data="AM";
				}
				document.getElementById("time").innerHTML="<h3>你好,欢迎访问贵美商城!</h3>"+year+"年"+month+"月"+day_of_Month+"日 "+"&nbsp;&nbsp;"+hour+":"+minute+":"+second+"&nbsp;&nbsp;"+data+"&nbsp;&nbsp;"+"星期"+day_of_Week;				
			}
			function close_clock(){
				clearInterval(flag);
			}
			function goon(){
				flag=setInterval("clock_12h()",1000);
			}
		</script>
	</body>
</html>
